import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

// 只用 state 和 mutations   不用常量，不用getters（过滤state数据） 和 actions（异步提交 mutation）
export default new Vuex.Store({
  state: {
    province: '',
    city: '',
    town: '',
    money: 0
  },
  mutations: {
    province (state, val) {
      state.province = val
    },
    city (state, val) {
      state.city = val
    },
    town (state, val) {
      state.town = val
    },
    money (state, val) {
      state.money = val
    }
  }
})
